package com.dongxing.concyrrency.chapter8;

/**
 * @author XavierDong
 **/
public class DeadLock {


    private  OtherService otherService;

    private final Object object = new Object();

    public void setOtherService(OtherService otherService) {
        this.otherService = otherService;
    }

    public void m1() {

        synchronized (object) {
            System.out.println("m1");
            otherService.s1();
        }
    }

    public void m2() {

        synchronized (object) {
            System.out.println("m2");
        }
    }
}
